<template>
  <div>
    <el-form ref="AdmiRef" :model="Admi" class="backlogin-box">
        <h3 style="text-align:center">管理员登录</h3>
        <el-form-item label="帐号">
            <el-input type="test" placeholder="请输入管理员名" v-model="Admi.name"></el-input>
        </el-form-item>
        <el-form-item label="密码">
            <el-input type="password" placeholder="请输入管理员密码" v-model="Admi.password"></el-input>
        </el-form-item>
        <el-form-item>
            <el-button type="success" @click="onsubmit">登陆</el-button>
        </el-form-item>
    </el-form>
  </div>
</template>
 
 

<script>
export default {
  name:'Backstage',
  data(){
    return{
      Admi:{
          name:'admin',
          password:'123456'
      }
    }
  },
  methods:{
      onsubmit() {
      this.$refs.AdmiRef.validate(async valid => {
        if (!valid)return
        else if(this.Admi.name == ""){
          this.$message({
            showClose: true,
            message: "请输入用户名！",
            type: "warning",
          })} else if(this.Admi.password == ""){
          this.$message({
            showClose: true,
            message: "请输入密码！",
            type: "error",
          })}
          if (this.Admi.name == "admin" && this.Admi.password == "123456"){
            window.sessionStorage.setItem('limits',1);
            window.sessionStorage.setItem('jur',1);
            this.$router.push('/selepurch');
          }
        }
        )
    },
  }
}
</script>

<style>
.backlogin-box{
    width: 350pt;
    margin: 150px auto;
    border: 1px solid #DCDFE6;
    padding:20px;
    border-radius: 5px;
    box-shadow: 0 0 30px #DCDFE6;
}
</style>